﻿<dialogs:DialogWindow x:Class="Mnk.TBox.Plugins.SkyNet.Forms.TaskDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:dialogs="clr-namespace:Mnk.Library.WpfControls.Dialogs;assembly=Mnk.Library.WpfControls"
             xmlns:loc="clr-namespace:Mnk.TBox.Plugins.SkyNet.Code.Localization"
             xmlns:components="clr-namespace:Mnk.Library.WpfControls.Components;assembly=Mnk.Library.WpfControls"
             xmlns:common="clr-namespace:Mnk.TBox.Tools.SkyNet.Common;assembly=Mnk.TBox.Tools.SkyNet.Common"
             xmlns:wpfSyntaxHighlighter="clr-namespace:Mnk.Library.WpfSyntaxHighlighter;assembly=Mnk.Library.WpfSyntaxHighlighter"
             mc:Ignorable="d" 
             Title="{loc:Tr PluginName}"
             ShowInTaskbar="True"
             MinWidth="640" MinHeight="480" 
             Width="640" Height="480" >
    <DockPanel>
        <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="10" Orientation="Horizontal">
            <Button Content="{loc:Tr Close}" Margin="5" IsCancel = "True" Click="CloseClick"/>
            <Button Content="{loc:Tr Start}" Margin="5" IsDefault ="True" Click="StartClick"/>
        </StackPanel>
        <TabControl>
            <TabItem Header="{loc:Tr Executing}">
                <DockPanel>
                    <DockPanel DockPanel.Dock="Top">
                        <Button Content="{loc:Tr SetParameters}" DockPanel.Dock="Right" Click="ConfigureScriptClick"/>
                        <TextBlock Text="{loc:Tr SetScript}" Margin="5 0" DockPanel.Dock="Left" VerticalAlignment="Center"/>
                        <TextBlock Text="{Binding Path}" Margin="5 0" VerticalAlignment="Center"/>
                    </DockPanel>
                    <wpfSyntaxHighlighter:SyntaxHighlighter Name="Report" Margin="5" Format="js" IsReadOnly="True" IsWordWrap="True"/>
                </DockPanel>
            </TabItem>
            <TabItem Header="{loc:Tr Tasks}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <GroupBox Header="{loc:Tr Agents}" Grid.Row="0">
                        <components:ExtListBox Name="ConnectedAgents" Margin="5">
                            <ListBox.ItemTemplate >
                                <DataTemplate DataType="common:ServerAgent">
                                    <DockPanel>
                                        <TextBlock Text="{Binding TotalCores}" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="5 0"/>
                                        <TextBlock Text="{Binding State}" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="5 0"/>
                                        <TextBlock Text="{Binding Endpoint}" VerticalAlignment="Center" Margin="5 0"/>
                                    </DockPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </components:ExtListBox>
                    </GroupBox>
                    <GroupBox Header="{loc:Tr Tasks}" Grid.Row="1">
                        <components:ExtListBox Name="ExistTasks" Margin="5">
                            <ListBox.ItemTemplate >
                                <DataTemplate DataType="common:ServerTask">
                                    <DockPanel>
                                        <Button Content="{loc:Tr Delete}"  DockPanel.Dock="Right" Click="DeleteTask" />
                                        <Button Content="{loc:Tr Terminate}"  DockPanel.Dock="Right" Click="TerminateTask" />
                                        <Button Content="{loc:Tr Cancel}"  DockPanel.Dock="Right" Click="CancelTask"/>
                                        <TextBlock Text="{Binding CreatedTime}" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="5 0"/>
                                        <TextBlock Text="{Binding State}" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="5 0"/>
                                        <TextBlock Text="{Binding Owner}" VerticalAlignment="Center" Margin="5 0"/>
                                    </DockPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </components:ExtListBox>
                    </GroupBox>
                </Grid>
            </TabItem>
        </TabControl>
    </DockPanel>
</dialogs:DialogWindow>
